package com.cloud.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cloud.entity.SysOperLogs;
import com.cloud.system.mapper.SysOperLogsMapper;
import com.cloud.system.service.ISysOperLogsService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 操作日志 服务层处理
 *
 * @author zx
 */
@Service
public class SysOperLogsServiceImpl extends ServiceImpl<SysOperLogsMapper, SysOperLogs> implements ISysOperLogsService {

    @Resource
    private SysOperLogsMapper operLogsMapper;

    /**
     * 新增操作日志
     *
     * @param operLogs 操作日志对象
     */
    @Override
    public int insertLogOper(SysOperLogs operLogs) {
        operLogs.setOperTime(new Date());
        return operLogsMapper.insert(operLogs);
    }

    /**
     * 查询系统操作日志集合
     *
     * @param operLogs 操作日志对象
     * @return 操作日志集合
     */
    @Override
    public List<SysOperLogs> selectLogOperList(SysOperLogs operLogs) {
        return operLogsMapper.selectLogOperList(operLogs);
    }

    /**
     * 批量删除系统操作日志
     *
     * @param operIds 需要删除的操作日志ID
     * @return 结果
     */
    @Override
    public int deleteLogOperByIds(List<Long> operIds) {
        return operLogsMapper.deleteLogOperByIds(operIds);
    }

    /**
     * 查询操作日志详细
     *
     * @param operId 操作ID
     * @return 操作日志对象
     */
    @Override
    public SysOperLogs selectLogOperById(Long operId) {
        return operLogsMapper.selectLogOperById(operId);
    }

    /**
     * 清空操作日志
     */
    @Override
    public void cleanLogOper() {
        operLogsMapper.cleanLogOper();
    }
}
